<template>
    <div>
        <el-main style="line-height:50px">
            <el-row :gutter="20">
                <el-col :span="18" :offset="3">
                    <el-result icon="success" :title="title" :subTitle="subTitle">
                        <template slot="extra">
                            <el-button type="primary" size="medium" @click="goBack">返回</el-button>
                        </template>
                    </el-result>
                </el-col>
            </el-row>
        </el-main>
    </div>
</template>
<script>
    export default{
        mounted(){
            this.title = this.$route.query.message
            setTimeout(()=>{
                this.goBack()
            },3000)
            this.subTitle = '返回主页面(3)'
            this.timer = setInterval(()=>{
                this.time = this.time - 1
                this.subTitle = '返回主页面('+(this.time)+')'
            },1000)
        },
        data(){
            return{
                title:'',
                time:3,
                subTitle:'',
                timer:''
            }
        },
        methods:{
            goBack(){
                this.$router.push({
                    path:'/customer',
                })
            }
        },
        beforeDestroy(){
            clearInterval(this.timer)
        }
    }
</script>